package com.qrxl.enums;

import com.qrxl.common.exception.CustomException;

public enum EnumSysFlag {

    YES(1, "有效"),
    NO(0, "无效"),
    ;
    private Integer code;
    private String name;

    EnumSysFlag(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static EnumSysFlag getType(Integer code) {
        for (EnumSysFlag anEnum : EnumSysFlag.values()) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        throw new CustomException("状态不合法!");
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
